package com.xzy.f;

import com.xzy.h.MyAopBeanPostProcessor;
import com.xzy.h.UserService;
import com.xzy.h.UserServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 说明：Bean生命周期之初始化前、初始化
 *
 * @author xzy
 * @date 2021/12/5 17:29
 */
@Slf4j
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(MyAopBeanPostProcessor.class);
        applicationContext.registerBean("userService", UserServiceImpl.class);
        applicationContext.refresh();

        UserService userService = applicationContext.getBean("userService", UserService.class);
        userService.sayHi();
        log.info("register type：{}", UserServiceImpl.class);
        log.info("real type：{}", userService.getClass());

    }
}
